<?php

#--------------------------------------------------
# ALL INCLUDES + STANDARD-VALUES
#--------------------------------------------------
include_once ("include/config.inc");
include_once ("include/template.inc");
include_once ("include/class.db.php5");
include_once ("include/class.tools.php5");
include_once ("include/class.time.php5");
$svo = new db("svoptik");
$tools = new tool();
$time = new TimeUtil();

include_once ("stats_inc.php5");
include_once ("include/global_fix_extern.inc");

#--------------------------------------------------
# CREATE TEMPLATE
#--------------------------------------------------
$t = new Template("templates", "keep");
$t->set_file(array (
	"page" => "svoptik.tpl",
	"ticker" => "ticker.tpl",
	"navi" => "navi.tpl",
	"team" => "team_tab.tpl"
));

#--------------------------------------------------
$t->set_var(array (
	"FORWARD" => ""
));

#--------------------------------------------------
# CREATE ALL-TIME SAME THINGS
#--------------------------------------------------
include_once ("include/sameThings.php5");

#--------------------------------------------------

#--------------------------------------------------
# CREATE NAVIGATION RIGHT
#--------------------------------------------------
if (!isset($team_id)){
	$team_id = 1;
}
// Team laden
$actTeam = $teamDao->findById($team_id);

$links = "";
$m = 1;
$url[0] = array (
	"URL" => "",
		"URL-TEXT" => $actTeam->name, //$team_data['stats_team_global_class'] . " " . $team_data['stats_team_global_index'],
	"ONCLICK" => "",
	"TARGET" => "_self"
);
$url[$m++] = array (
	"URL" => "team.php5?team_id=" . $team_id . "&cat=News",
	"URL-TEXT" => "-&nbsp;News",
	"ONCLICK" => "",
	"TARGET" => "_self"
);
$url[$m++] = array (
	"URL" => "team.php5?team_id=" . $team_id . "&cat=Team",
	"URL-TEXT" => "-&nbsp;Team",
	"ONCLICK" => "",
	"TARGET" => "_self"
);
$url[$m++] = array (
	"URL" => "",
	"URL-TEXT" => "-&nbsp;Tabelle",
	"ONCLICK" => "",
	"TARGET" => "_self"
);
$url[$m++] = array (
	"URL" => "team_schedule.php5?team_id=" . $team_id . "&complete=0",
	"URL-TEXT" => "-&nbsp;Spielplan",
	"ONCLICK" => "",
	"TARGET" => "_self"
);
$url[$m++] = array (
	"URL" => "team_stats.php5?team_id=" . $team_id,
	"URL-TEXT" => "-&nbsp;Statistiken",
	"ONCLICK" => "",
	"TARGET" => "_self"
);
$url[$m++] = array (
	"URL" => "",
	"URL-TEXT" => "SPACER",
	"ONCLICK" => "",
	"TARGET" => "_self"
);

for ($i = 0; $i < count($url); $i++) {
	if ($url[$i]['URL-TEXT'] != "SPACER") {
		if (!empty ($url[$i]['URL']))
			$slink = "<a href=\"" . $url[$i]['URL'] . "\" class=\"sitenav\" target=\"" . $url[$i]['TARGET'] . "\" onClick=\"" . $url[$i]['ONCLICK'] . "\">" . $tools->html_replace($url[$i]['URL-TEXT']) . "</a>";
		else
			$slink = "<b>" . $tools->html_replace($url[$i]['URL-TEXT']) . "</b>";
	} else
		$slink = "&nbsp;";
	$links .= "
	        <tr height=\"15\">
				<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
				<td valign=\"top\" class=\"sitenav\">" . $slink . "</td>
				<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
			</tr>
	       ";
}
$t->set_var(array (
	"LINKS" => $links,
	"BANNER" => $banner
));
$right_nav = $t->parse("", "navi", true);
#--------------------------------------------------

#--------------------------------------------------
# CREATE CONTENT "TEAMSITE"
#--------------------------------------------------

$t->set_var(array ("LIGA" => $actTeam->liga));
$content = $t->parse("", "team", true);

#--------------------------------------------------

#--------------------------------------------------
# PARSE & OUTPUT
#--------------------------------------------------
$t->set_var(array (
	"sitenav" => "TEAMS -> " . $tools->html_replace(strtoupper("Red Eagles Rathenow - " . $actTeam->name . " " . $actTeam->suffix
)) . " (SAISON " . $actTeam->saison . "/".($actTeam->saison + 1).") -> TABELLE", //.$team_data['stats_season_name'].")",
"ticker" => $ticker, "content" => $content . "<br>", "navi" => $right_nav,
	"SYNCHRONIZE" => " "));

$t->parse("ALL", "page", true);
$t->p("ALL");
?>
